package controlador;

import java.net.URL;
import java.util.ResourceBundle;

import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.Button;
import javafx.scene.control.ToolBar;

public class Principal implements Initializable	{

	@FXML
	ToolBar tlbMenu;
	
	@FXML
	Button btnUsuarios;
			
	@FXML	
	Button btnProductos;
	
	@FXML	
	Button btnVentas;
	
	@FXML
	Button btnCerrarSesion;
	
	private application.Main mainApp;
	
	
	@Override
	public void initialize(URL arg0, ResourceBundle arg1) {
		// TODO Auto-generated method stub
		btnProductos.setOnAction(new btnProductos_click());
		btnUsuarios.setOnAction(new btnUsuarios_click());
		btnVentas.setOnAction(new btnVentas_click());
		btnCerrarSesion.setOnAction(new btnCerrarSesion_click());
	}

	private class btnProductos_click implements EventHandler<ActionEvent>{
		@Override
		public void handle(ActionEvent arg0) {
			// TODO Auto-generated method stub
			mainApp.showProductos();
		}
	}
	
	private class btnUsuarios_click implements EventHandler<ActionEvent>{
		@Override
		public void handle(ActionEvent arg0) {
			// TODO Auto-generated method stub
			mainApp.showUsuarios();	
		}		
	}
	
	private class btnVentas_click implements EventHandler<ActionEvent>{
		@Override
		public void handle(ActionEvent arg0) {
			// TODO Auto-generated method stub
			mainApp.showVentas();	
		}		
	}
	
	private class btnCerrarSesion_click implements EventHandler<ActionEvent>{
		@Override
		public void handle(ActionEvent arg1) {
			// TODO Auto-generated method stub
			System.exit(0);
		}
	}
	
	public void setMain(application.Main mainApp){

		this.mainApp=mainApp;
	}
}
